<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport"
			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../../css/header.css" />

	</head>

	<body>

		<header class="mui-bar mui-bar-nav title">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" style="color: white;"></a>
			<a id="submit_questionnaire" class="mui-icon mui-icon-right-nav mui-pull-right"
							style="color: white;font-size: 14px;line-height: 27px;">提交</a>
			<h1 class="mui-title title-color">实习问卷填写</h1>
		</header>

		<div class="mui-content">
			
			<div class="mui-card radio_question_div">
				<h5 class="mui-card-content-inner" style="color: black; font-weight: bold">1.请选择您的性别</h5>
				<div class="mui-input-group">
					<div class="mui-input-row mui-radio mui-left">
						<label>男</label>
						<input name="sex" type="radio" value="男">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>女</label>
						<input name="sex" type="radio" value="女">
					</div>
				</div>
			</div>
			
			<div class="mui-card radio_question_div">
				<h5 class="mui-card-content-inner" style="color: black; font-weight: bold">2.您实习的岗位是否与专业对口</h5>
				<div class="mui-input-group">
					<div class="mui-input-row mui-radio mui-left">
						<label>对口</label>
						<input name="specializedField" type="radio" value="对口">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>不对口</label>
						<input name="specializedField" type="radio" value="不对口">
					</div>
				</div>
			</div>
			
			<div class="mui-card radio_question_div">
				<h5 class="mui-card-content-inner" style="color: black; font-weight: bold">3.您认为企业在招收实习生时是否参看大学是否是一本/985/211高校</h5>
				<div class="mui-input-group">
					<div class="mui-input-row mui-radio mui-left">
						<label>当然，那是企业对实习生的第一印象</label>
						<input name="education" type="radio" value="当然，那是企业对实习生的第一印象">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>不是，个人综合能力最重要</label>
						<input name="education" type="radio" value="不是，个人综合能力最重要">
					</div>
				</div>
			</div>
			
			<div class="mui-card radio_question_div">
				<h5 class="mui-card-content-inner" style="color: black; font-weight: bold">4.您认为“打下手”般的工作可不可以学到东西</h5>
				<div class="mui-input-group">
					<div class="mui-input-row mui-radio mui-left">
						<label>可以</label>
						<input name="act_as_assistant" type="radio" value="可以">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>不可以</label>
						<input name="act_as_assistant" type="radio" value="不可以">
					</div>
				</div>
			</div>
			
			<div class="mui-card radio_question_div">
				<h5 class="mui-card-content-inner" style="color: black; font-weight: bold">5.如果让您自由选择实习岗位，您会选择</h5>
				<div class="mui-input-group">
					<div class="mui-input-row mui-radio mui-left">
						<label>与所学专业对口的</label>
						<input name="choose_job_type" type="radio" value="与所学专业对口的">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>工资高，待遇好的</label>
						<input name="choose_job_type" type="radio" value="工资高，待遇好的">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>自己感兴趣的</label>
						<input name="choose_job_type" type="radio" value="自己感兴趣的">
					</div>
				</div>
			</div>
			
			<div class="mui-card radio_question_div">
				<h5 class="mui-card-content-inner" style="color: black; font-weight: bold">6.作为实习生，您可以接受的实习期限是多长</h5>
				<div class="mui-input-group">
					<div class="mui-input-row mui-radio mui-left">
						<label>一个月</label>
						<input name="internship_period" type="radio" value="一个月">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>两个月</label>
						<input name="internship_period" type="radio" value="两个月">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>三个月</label>
						<input name="internship_period" type="radio" value="三个月">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>四个月</label>
						<input name="internship_period" type="radio" value="四个月">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>五个月</label>
						<input name="internship_period" type="radio" value="五个月">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>六个月</label>
						<input name="internship_period" type="radio" value="六个月">
					</div>
				</div>
			</div>
			
			<div class="mui-card radio_question_div">
				<h5 class="mui-card-content-inner" style="color: black; font-weight: bold">7.作为一名实习生，您认为每月多少工资可以接受</h5>
				<div class="mui-input-group">
					<div class="mui-input-row mui-radio mui-left">
						<label>免薪</label>
						<input name="salary" type="radio" value="免薪">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>1000-2000</label>
						<input name="salary" type="radio" value="1000-2000">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>2000-3000</label>
						<input name="salary" type="radio" value="2000-3000">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>3000-4000</label>
						<input name="salary" type="radio" value="3000-4000">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>4000-5000</label>
						<input name="salary" type="radio" value="4000-5000">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>5000+</label>
						<input name="salary" type="radio" value="5000+">
					</div>
				</div>
			</div>
			
			<div class="mui-card radio_question_div">
				<h5 class="mui-card-content-inner" style="color: black; font-weight: bold">8.您认为在校生提前实习的利弊如何</h5>
				<div class="mui-input-group">
					<div class="mui-input-row mui-radio mui-left">
						<label>利大于弊</label>
						<input name="practice_in_advance" type="radio" value="利大于弊">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>弊大于利</label>
						<input name="practice_in_advance" type="radio" value="弊大于利">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>利弊相等</label>
						<input name="practice_in_advance" type="radio" value="利弊相等">
					</div>
				</div>
			</div>
			
			<div class="mui-card text_question_div">
				<h5 class="mui-card-content-inner" style="color: black; font-weight: bold">请输入您的手机号码</h5>
				<div class="mui-input-group">
					<div class="mui-input-row">
						<input type="number" class="mui-input-clear" placeholder="请输入手机号码">
					</div>
				</div>
			</div>
			
		</div>

		<script src="../../js/mui.min.js"></script>
		<script src="../../js/app.js"></script>
		<script type="text/javascript">
			mui.init()

			mui.plusReady(function() {
				var userinfo = app.getGlobalUserInfo();
				
				// 点击提交按钮，提交学生打卡信息
				submit_questionnaire.addEventListener("tap", function() {
					// 记录所有的问题和答案
					var questions = [];
					// 获取所有的单选问题和答案
					var radio_questions_h5 = document.querySelectorAll(".radio_question_div h5");
					var radio_answers_radio = document.querySelectorAll(".radio_question_div input:checked");
					// 校验单选问题是否都选了
					if(radio_questions_h5.length > radio_answers_radio.length) {
						app.showToast("您有未勾选的问题！", "error");
						return;
					}
					var i = 0;
					for(; i < radio_questions_h5.length; i++) {
						questions[i] = {};
						questions[i].question = radio_questions_h5[i].innerHTML;
						questions[i].answer = radio_answers_radio[i].value;
					}

					// 获取所有的输入框问题和答案
					var text_questions_h5 = document.querySelectorAll(".text_question_div h5");
					var text_answers_text = document.querySelectorAll(".text_question_div input");
					// 校验输入框问题是否都填了
					for(var k = 0; k < text_answers_text.length; k++) {
						if(!app.isNotNull(text_answers_text[k].value)) {
							app.showToast("有输入项未填写！请填写后重试。");
							return;
						}
					}
					for(var j = 0; j < text_questions_h5.length; j++) {
						questions[i + j] = {};
						questions[i + j].question = text_questions_h5[j].innerHTML;
						questions[i + j].answer = text_answers_text[j].value;
					}
					// questions[0].question = document.querySelectorAll("#sex_div h5")[0].innerHTML;
					// questions[0].answer = document.querySelectorAll("#sex_div input:checked")[0].value;
					console.log(JSON.stringify(questions));
					
					mui.ajax(app.serverUrl + "/user/student/submitInternshipQuestionnaire", {
						data:{
							user_id: userinfo.user_id,
							q_content: JSON.stringify(questions)
						},
						dataType:'json',//服务器返回json格式数据
						type:'post',//HTTP请求类型
						timeout:10000,//超时时间设置为10秒；
						headers:{'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8'},	              
						success:function(data){
							if(data.status == 200) {
								app.showToast("问卷已提交", "success");
								mui.back();
							} else {
								app.showToast(data.msg, "error");
							}
						},
						error:function(xhr,type,errorThrown){
							//异常处理；
							console.log(type);
						}
					});
				});
				
			});
		</script>
	</body>

</html>